package id.mankel.commons.function;

import java.util.function.Supplier;

/**
 * Normal Supplier: <code>Supplier&lt;T&gt; s = () -> "test";</code>
 * <p>
 * Throwable Supplier: <code>(ThrowableSupplier&lt;T&gt;) () -> "test";</code>
 * @see org.apache.commons.lang3.function.Failable
 */
@FunctionalInterface
public interface ThrowableSupplier<T> extends Supplier<T> {

    @Override
    default T get() {
        try {
            return this.throwableGet();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    T throwableGet() throws Exception;

}
